home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Message Dialogs / post-it-note.izs < prev    next >
Text File  |  2005-09-28  |  7KB  |  287 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Post-it note
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>This is a cross browser "post-it note" script. Use it to broadcast special events or news on your site. Easily dismissed, the script also allows you to specify the frequency of its appearance (either once per browser session, or every time the page containing it is loaded). And last but not least, in IE4/NS6, you can drag the note around.
  7. <!/DESCRIPTION> 
  8.  
  9. <!CATEGORY>messages<!/CATEGORY>
  10.  
  11. <!SCRIPT>
  12. <!-- START OF SCRIPT -->
  13. <style>
  14. <!--
  15.  
  16. #postit{
  17. position:absolute;
  18. width:250;
  19. padding:5px;
  20. background-color:lightyellow;
  21. border:1px solid black;
  22. visibility:hidden;
  23. z-index:100;
  24. cursor:hand;
  25. }
  26.  
  27. -->
  28. </style>
  29. <div id="postit" style="left:150px;top:150px">
  30. <div align="right"><b><a href="javascript:closeit()">[Close It]</a></b></div>
  31.  
  32. <!--INSERT YOUR CONTENT HERE-->
  33.  
  34. <b>Reminder:</b><br>
  35. <p><font size="2" face="Arial"><a href="http://freewarejava.com" target="_new">Looking for
  36. free Java applets?<br>
  37. </a>Be sure to check out our sister site Freewarejava.com</font></p>
  38. <p><font size="2" face="Arial"><a href="http://www.dynamicdrive.com" target="_new">Looking for
  39. more scripts?<br>
  40. </a>Visit our partner Dynamic Drive for free, original DHTML scripts and
  41. components.</font></p>
  42.  
  43. <!--END YOUR CONTENT HERE-->
  44.  
  45. </div>
  46.  
  47. <script>
  48.  
  49. //Post-it only once per browser session? (0=no, 1=yes)
  50. //Specifying 0 will cause postit to display every time page is loaded
  51. var once_per_browser=0
  52.  
  53. ///No need to edit beyond here///
  54.  
  55. var ns4=document.layers
  56. var ie4=document.all
  57. var ns6=document.getElementById&&!document.all
  58.  
  59. if (ns4)
  60. crossobj=document.layers.postit
  61. else if (ie4||ns6)
  62. crossobj=ns6? document.getElementById("postit") : document.all.postit
  63.  
  64.  
  65. function closeit(){
  66. if (ie4||ns6)
  67. crossobj.style.visibility="hidden"
  68. else if (ns4)
  69. crossobj.visibility="hide"
  70. }
  71.  
  72. function get_cookie(Name) {
  73.   var search = Name + "="
  74.   var returnvalue = "";
  75.   if (document.cookie.length > 0) {
  76.     offset = document.cookie.indexOf(search)
  77.     if (offset != -1) { // if cookie exists
  78.       offset += search.length
  79.       // set index of beginning of value
  80.       end = document.cookie.indexOf(";", offset);
  81.       // set index of end of cookie value
  82.       if (end == -1)
  83.          end = document.cookie.length;
  84.       returnvalue=unescape(document.cookie.substring(offset, end))
  85.       }
  86.    }
  87.   return returnvalue;
  88. }
  89.  
  90. function showornot(){
  91. if (get_cookie('postdisplay')==''){
  92. showit()
  93. document.cookie="postdisplay=yes"
  94. }
  95. }
  96.  
  97. function showit(){
  98. if (ie4||ns6)
  99. crossobj.style.visibility="visible"
  100. else if (ns4)
  101. crossobj.visibility="show"
  102. }
  103.  
  104. if (once_per_browser)
  105. showornot()
  106. else
  107. showit()
  108.  
  109. </script>
  110.  
  111. <script language="JavaScript1.2">
  112.  
  113. //drag drop function for ie4+ and NS6////
  114. /////////////////////////////////
  115.  
  116. function drag_drop(e){
  117. if (ie4&&dragapproved){
  118. crossobj.style.left=tempx+event.clientX-offsetx
  119. crossobj.style.top=tempy+event.clientY-offsety
  120. return false
  121. }
  122. else if (ns6&&dragapproved){
  123. crossobj.style.left=tempx+e.clientX-offsetx
  124. crossobj.style.top=tempy+e.clientY-offsety
  125. return false
  126. }
  127. }
  128.  
  129. function initializedrag(e){
  130. if (ie4&&event.srcElement.id=="postit"||ns6&&e.target.id=="postit"){
  131. offsetx=ie4? event.clientX : e.clientX
  132. offsety=ie4? event.clientY : e.clientY
  133.  
  134. tempx=parseInt(crossobj.style.left)
  135. tempy=parseInt(crossobj.style.top)
  136.  
  137. dragapproved=true
  138. document.onmousemove=drag_drop
  139. }
  140. }
  141. document.onmousedown=initializedrag
  142. document.onmouseup=new Function("dragapproved=false")
  143.  
  144. </script>
  145. <!-- END OF SCRIPT -->
  146. <!/SCRIPT>
  147.  
  148. <!PREVIEW>
  149. <!-- START OF SCRIPT -->
  150.  
  151. <style>
  152. <!--
  153.  
  154. #postit{
  155. position:absolute;
  156. width:250;
  157. padding:5px;
  158. background-color:lightyellow;
  159. border:1px solid black;
  160. visibility:hidden;
  161. z-index:100;
  162. cursor:hand;
  163. }
  164.  
  165. -->
  166. </style>
  167. <div id="postit" style="left:150px;top:150px">
  168. <div align="right"><b><a href="javascript:closeit()">[Close It]</a></b></div>
  169.  
  170. <!--INSERT YOUR CONTENT HERE-->
  171.  
  172. <b>Reminder:</b><br>
  173. <p><font size="2" face="Arial"><a href="http://freewarejava.com" target="_new">Looking for
  174. free Java applets?<br>
  175. </a>Be sure to check out our sister site Freewarejava.com</font></p>
  176. <p><font size="2" face="Arial"><a href="http://www.dynamicdrive.com" target="_new">Looking for
  177. more scripts?<br>
  178. </a>Visit our partner Dynamic Drive for free, original DHTML scripts and
  179. components.</font></p>
  180.  
  181. <!--END YOUR CONTENT HERE-->
  182.  
  183. </div>
  184.  
  185. <script>
  186.  
  187. //Post-it only once per browser session? (0=no, 1=yes)
  188. //Specifying 0 will cause postit to display every time page is loaded
  189. var once_per_browser=0
  190.  
  191. ///No need to edit beyond here///
  192.  
  193. var ns4=document.layers
  194. var ie4=document.all
  195. var ns6=document.getElementById&&!document.all
  196.  
  197. if (ns4)
  198. crossobj=document.layers.postit
  199. else if (ie4||ns6)
  200. crossobj=ns6? document.getElementById("postit") : document.all.postit
  201.  
  202.  
  203. function closeit(){
  204. if (ie4||ns6)
  205. crossobj.style.visibility="hidden"
  206. else if (ns4)
  207. crossobj.visibility="hide"
  208. }
  209.  
  210. function get_cookie(Name) {
  211.   var search = Name + "="
  212.   var returnvalue = "";
  213.   if (document.cookie.length > 0) {
  214.     offset = document.cookie.indexOf(search)
  215.     if (offset != -1) { // if cookie exists
  216.       offset += search.length
  217.       // set index of beginning of value
  218.       end = document.cookie.indexOf(";", offset);
  219.       // set index of end of cookie value
  220.       if (end == -1)
  221.          end = document.cookie.length;
  222.       returnvalue=unescape(document.cookie.substring(offset, end))
  223.       }
  224.    }
  225.   return returnvalue;
  226. }
  227.  
  228. function showornot(){
  229. if (get_cookie('postdisplay')==''){
  230. showit()
  231. document.cookie="postdisplay=yes"
  232. }
  233. }
  234.  
  235. function showit(){
  236. if (ie4||ns6)
  237. crossobj.style.visibility="visible"
  238. else if (ns4)
  239. crossobj.visibility="show"
  240. }
  241.  
  242. if (once_per_browser)
  243. showornot()
  244. else
  245. showit()
  246.  
  247. </script>
  248.  
  249. <script language="JavaScript1.2">
  250.  
  251. //drag drop function for ie4+ and NS6////
  252. /////////////////////////////////
  253.  
  254. function drag_drop(e){
  255. if (ie4&&dragapproved){
  256. crossobj.style.left=tempx+event.clientX-offsetx
  257. crossobj.style.top=tempy+event.clientY-offsety
  258. return false
  259. }
  260. else if (ns6&&dragapproved){
  261. crossobj.style.left=tempx+e.clientX-offsetx
  262. crossobj.style.top=tempy+e.clientY-offsety
  263. return false
  264. }
  265. }
  266.  
  267. function initializedrag(e){
  268. if (ie4&&event.srcElement.id=="postit"||ns6&&e.target.id=="postit"){
  269. offsetx=ie4? event.clientX : e.clientX
  270. offsety=ie4? event.clientY : e.clientY
  271.  
  272. tempx=parseInt(crossobj.style.left)
  273. tempy=parseInt(crossobj.style.top)
  274.  
  275. dragapproved=true
  276. document.onmousemove=drag_drop
  277. }
  278. }
  279. document.onmousedown=initializedrag
  280. document.onmouseup=new Function("dragapproved=false")
  281.  
  282. </script>
  283. <!-- END OF SCRIPT -->
  284. <!/PREVIEW>
  285.  
  286. <!RELATED>NONE<!/RELATED>
  287.